package com.hp.springboottextcach.service;

import com.hp.springboottextcach.entity.deptmber;
import com.hp.springboottextcach.mapper.deptmberUs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.stereotype.Service;

@Service
@EnableCaching
public class deptmberService {

    @Autowired
    deptmberUs deptmberUs;
    /*@Cacheable(cacheNames = "deptmber")//缓存*/
    public deptmber SelectAllById(Integer id){
        deptmber deptmber = deptmberUs.SelectDeptmberByid(id);
        System.out.println("员工"+id);
        return deptmber;
    }
    //@CachePut() 修改缓存
    /*@CacheEvict(value = "deptmber")//删除*/
    public int delect(Integer id){
        int i = deptmberUs.delectById(id);
           return i;
    }
}
